%%-*- mode: erlang -*-
CONFIG1 = case os:getenv("TRAVIS") of
              "true" ->
                  JobId = os:getenv("TRAVIS_JOB_ID"),
                  [{coveralls_service_job_id, JobId},
                   {coveralls_coverdata, "_build/test/cover/*.coverdata"},
                   {coveralls_service_name , "travis-ci"} | CONFIG];
              _ ->
                  CONFIG
          end,

CUR_BRANCH = os:cmd("git branch | grep -e '^*' | cut -d' ' -f 2") -- "\n",

BRANCH = case lists:member(CUR_BRANCH, ["master", "develop"]) of
             true -> CUR_BRANCH;
             false -> "develop"
         end,

DEPS = case lists:keyfind(deps, 1, CONFIG1) of
           {_, Deps} -> Deps;
           _ -> []
       end,

NewDeps = DEPS,

CONFIG2 = lists:keystore(deps, 1, CONFIG1, {deps, NewDeps}),

CONFIG2.
